package Tset2;
import java.util.Random;

/**
 * 随机生成五位验证码，前四位是随机大小写字母，第五位是数字
 */
public class Demo2 {
    public static void main(String[] args) {
        int[] randomArray = randomCreate();
        for (int i = 0; i < randomArray.length; i++) {
            if(i== randomArray.length-1){
                System.out.print(randomArray[i]);
            }
            System.out.print((char)randomArray[i]);
        }
    }
    public static int[] randomCreate(){
        int[] arr = new int[5];
        Random r = new Random();
        for (int i = 0; i < 4; i++) {
            arr[i] = r.nextBoolean() ? r.nextInt(65,91) : r.nextInt(97,123);
        }
        arr[4] = r.nextInt(1,10);
        return arr;
    }
}
